{% extends './main.html' %}
{% block CSS %}

{% end %}
{% block JS %}
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            // var index = layer.alert(JSON.stringify(data.field), {
            //     title: '最终的提交信息'
            // }, function () {
            //
            //     // 关闭弹出层
            //     layer.close(index);
            //
            //     var iframeIndex = parent.layer.getFrameIndex(window.name);
            //     parent.layer.close(iframeIndex);
            //
            // });
            var data = {};
            $(".layuimini-form input,.layuimini-form textarea,.layuimini-form select").each(function () {
                var name = $(this).attr('name');
                var val = $(this).val();
                data[name] = val;
            });
            data["type"]=$(".layuimini-form input[name='type']:checked").val();
            $.post("/e/vodedit", data, function (html) {
                layer.msg(html.message,{icon: 1,time: 2000},function () {
                    //父窗口数据刷新
                    parent.layui.table.reload("currentTableId");
                    //
                    var iframeIndex = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(iframeIndex);
                })
            }, "json")
            return false;
        });

    });
</script>
{% end %}
{% block Body %}
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">类型</label>
        <div class="layui-input-block">
            <input type="radio" name="type" value="1" title="电影" checked="">
            <input type="radio" name="type" value="2" title="电视剧">
            <input type="radio" name="type" value="3" title="综艺">
            <input type="radio" name="type" value="4" title="动漫">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">分类</label>
        <div class="layui-input-block">

            <input type="hidden" name="channel" value="{{vod_obj['channel']}}" >
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" lay-reqtext="名称不能为空" placeholder="请输入名称" value="{{vod_obj['name']}}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">别名</label>
        <div class="layui-input-inline">
            <input type="text" name="othername" placeholder="请输入别名" value="{{vod_obj['othername']}}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">导演</label>
        <div class="layui-input-block">
            <input type="text" name="director" placeholder="请输入导演" value="{{vod_obj['director']}}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">主演</label>
        <div class="layui-input-block">
            <input type="text" name="actor" placeholder="请输入主演" value="{{vod_obj['actor']}}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">年代</label>
        <div class="layui-input-inline">
            <input type="text" name="year" placeholder="请输入年代" value="{{vod_obj['year']}}" class="layui-input">
        </div>

        <label class="layui-form-label">区域</label>
        <div class="layui-input-inline">
            <input type="text" name="area" placeholder="请输入区域" value="{{vod_obj['area']}}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">时长</label>
        <div class="layui-input-inline">
            <input type="text" name="timelong" placeholder="分钟" value="{{vod_obj['timelong']}}" class="layui-input">
        </div>

        <label class="layui-form-label">评分</label>
        <div class="layui-input-inline">
            <input type="text" name="star" placeholder="分" value="{{vod_obj['star']}}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-inline">
            <input type="checkbox" checked="" name="status" lay-skin="switch" lay-filter="switchTest" title="开关"  lay-text="ON|OFF">
        </div>

        <label class="layui-form-label">推荐</label>
        <div class="layui-input-inline">
            <select name="recom" lay-verify="required" lay-search="">
                <option value="0">选择</option>
                <option value="1">头条推荐</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">广告语</label>
        <div class="layui-input-block">
            <input type="text" name="ads" placeholder="请输入广告语" value="{{vod_obj['ads']}}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">标签</label>
        <div class="layui-input-block">
            <input type="text" name="tags" placeholder="请输入标签" value="{{vod_obj['tags']}}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">封面</label>
        <div class="layui-input-block">
            <input type="text" name="conver" placeholder="请输入封面" value="{{vod_obj['conver']}}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">简介</label>
        <div class="layui-input-block">
            <textarea name="introduce" class="layui-textarea" placeholder="请输入简介">{{vod_obj['introduce']}}</textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="saveBtn">确认保存</button>
            <input type="hidden" name="id" value="{{vod_obj['id']}}">
            <input type="hidden" name="action" value="add">
        </div>
    </div>
</div>
{% end %}